<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    var rw=prompt("请输入红球和白球的个数");
    var wb=prompt("请输入白球和黑球的个数");
    var rb=prompt("请输入红球和黑球的个数");
    

for (var red=1;red <= rw;red++) {

        var black = rb-red;

        var white = rw-red;
    if(white+red==rw&&white+black==wb&&red+black==rb){
        alert("红球为"+red+"个;"+"白球为"+white+"个;"+"+黑球为"+black+"个;")
    }
    
    }
</script>
</body>
</html>